package com.free.gulimall.order;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;

/**
 * 要远程调用别的服务
 * 1.引入oper-feign
 * 2.编写一个接口，告诉SpringBoot这个接口需要调用远程服务
 *  1) 声明接口的每一个方法都是调用哪一个远程服务的哪一个请求
 * 3.开启远程调用功能 @EnableFeignClients(basePackages = "com.free.gulimall.order.feign")


 * 使用RabbitMQ
 * 1、引入amqp场景：RabbitAutoConfiguration 就会自动生成
 * 2、给容器中自动配置了
 *      RabbitTemplate、amqpAdmin、RabbitMessagingTemplate、CachingConnectionFactory
 *      所有属性都是 spring.rabbitmq
 *      @ConfigurationProperties(prefix = "spring.rabbitmq")
 * 3、给配置文件中配置 spring.rabbitmq开头的信息
 * 4、@EnableRabbit  @EnableXXX 开启功能
 * 5、监听消息 使用 @RabbitListener；必须要有@EnableRabbit
 *
 */
@EnableRedisHttpSession
@EnableRabbit
@EnableFeignClients(basePackages = "com.free.gulimall.order.feign")
@EnableDiscoveryClient
@MapperScan("com.free.gulimall.order.dao")
@SpringBootApplication
public class GulimallOrderApplication {

    public static void main(String[] args) {
        SpringApplication.run(GulimallOrderApplication.class, args);
    }

}
